//
//  UILabel+Extension.swift
//  WeiBo2017
//
//  Created by 王璐 on 2017/4/19.
//  Copyright © 2017年 wl. All rights reserved.
//

import UIKit

extension UILabel{

    /// 创建UILabel
    ///
    /// - parameter text:      text
    /// - parameter fontSize:  fontSize 默认14
    /// - parameter color:     color,默认darkGray
    /// - parameter alignment: alignment,默认左对齐
    ///
    /// - returns: UILabel
    convenience init(wl_text:String,
         fontSize:CGFloat = 14,
         color:UIColor=UIColor.darkGray,
         alignment:NSTextAlignment = .left){
        
            self.init()
            
            self.text = wl_text
            self.textAlignment = alignment
            self.textColor = color
            self.font = UIFont.systemFont(ofSize: fontSize)
            
            self.numberOfLines = 0
            
            //自动调整大小
            sizeToFit()
    }

}
